/* Version Component Styles */

.versionContainer {
  position: relative;
  display: inline-block;
  z-index: 1000; /* 确保容器本身也有足够高的层级 */
}

.versionButton {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: var(--color-toolbar-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  outline: none;
}

.versionButton:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.versionButton:active {
  transform: translateY(0);
}

.versionLabel {
  font-family: 'Monaco', 'Menlo', monospace;
  letter-spacing: 0.5px;
}

.chevron {
  transition: transform var(--transition-normal);
}

.chevronOpen {
  transform: rotate(180deg);
}

/* Dropdown Styles */
.dropdown {
  position: absolute;
  /* 位置属性由 JavaScript 动态设置 */
  min-width: 280px;
  max-width: 400px;
  background: var(--color-surface, #ffffff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 9999; /* 提高z-index确保在所有组件之上 */
  overflow: hidden;
  animation: dropdownFadeIn 0.2s ease-out;
  /* 确保下拉菜单内部可以滚动 */
  display: flex;
  flex-direction: column;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 为向上显示的下拉菜单添加不同的动画 */
.dropdown[data-direction="up"] {
  animation: dropdownFadeInUp 0.2s ease-out;
}

@keyframes dropdownFadeInUp {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dropdownHeader {
  padding: 16px 16px 8px 16px;
  border-bottom: 1px solid var(--color-border-secondary, #f3f4f6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dropdownTitle {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.headerLink {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: white;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  position: relative;
  overflow: hidden;
  transform: translateY(0);
}

.headerLink::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.headerLink:hover::before {
  left: 100%;
}

.headerLink:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  text-decoration: none;
}

.headerLink:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.headerIcon {
  flex-shrink: 0;
  opacity: 0.9;
}

.headerText {
  font-weight: 600;
  letter-spacing: 0.5px;
}

.headerArrow {
  flex-shrink: 0;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.headerLink:hover .headerArrow {
  transform: translate(1px, -1px);
}

.versionList {
  /* 最大高度由 JavaScript 动态设置 */
  overflow-y: auto;
  padding: 8px 0;
  /* 确保在移动端也能正常滚动 */
  -webkit-overflow-scrolling: touch;
}

.versionItem {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-secondary, #f3f4f6);
  transition: background-color var(--transition-normal);
}

.versionItem:last-child {
  border-bottom: none;
}

.versionItem:hover {
  background: var(--color-hover);
}

.currentVersion {
  background: rgba(34, 197, 94, 0.1);
  border-left: 3px solid #22c55e;
}

.versionHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.versionInfo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.versionNumber {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.currentBadge {
  padding: 2px 6px;
  background: #22c55e;
  color: white;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.versionDate {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.versionDescription {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--color-text-primary);
  line-height: 1.4;
}

.changesList {
  margin: 0;
  padding-left: 16px;
  list-style: none;
}

.changeItem {
  position: relative;
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
  padding-left: 12px;
}

.changeItem:before {
  content: '•';
  position: absolute;
  left: 0;
  color: #22c55e;
  font-weight: 600;
}

.changeItem:last-child {
  margin-bottom: 0;
}

/* Footer样式已移除，关注作者链接移到了header */

/* 滚动条样式 */
.versionList::-webkit-scrollbar {
  width: 6px;
}

.versionList::-webkit-scrollbar-track {
  background: transparent;
}

.versionList::-webkit-scrollbar-thumb {
  background: var(--color-border-primary);
  border-radius: 3px;
}

.versionList::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .dropdown {
    /* 移动端下拉菜单样式 */
    border-radius: 8px;
    /* 移动端不需要额外的 margin，通过 JS 定位控制 */
  }
  
  .versionContainer {
    position: relative;
    z-index: 1;
  }
  
  .versionButton {
    /* 在移动端稍微增大点击区域 */
    padding: 6px 10px;
  }
  
  /* 移动端优化滚动区域 */
  .versionList {
    /* 确保有足够的滚动空间 */
    min-height: 150px;
  }
  
  /* 移除footer相关的移动端样式 */
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
  .dropdown {
    /* 超小屏幕进一步优化 */
    border-radius: 6px;
  }
  
  .dropdownHeader {
    padding: 12px 16px 8px 16px;
  }
  
  .headerLink {
    font-size: 10px;
    padding: 5px 10px;
    border-radius: 10px;
  }
  
  .headerText {
    display: none; /* 超小屏幕隐藏文字，只显示图标 */
  }
  
  .versionItem {
    padding: 10px 16px;
  }
  
  .tipText {
    font-size: 11px;
    padding: 8px 12px;
  }
  
  /* 超小屏幕确保底部内容可见 */
  .versionList {
    min-height: 120px;
  }
}

/* 暗色主题适配 */
[data-theme="dark"] .headerLink {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] .headerLink:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}
